﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Weather.Base;
using System.Text.RegularExpressions;
using WeatherProviders;
using System.Net;
using System.IO;

namespace RP53
{
    public class WeatherProvider : IWeatherProvider
    {
        const String prefix = "rp5";
        Regex rePrefix = new Regex(prefix + "\\|(.+)$");
        public List<LocationData> GetLocations(string query, System.Globalization.CultureInfo culture, TemperatureScale tempScale)
        {
            return GetLocations(query, culture);
        }
        public List<LocationData> GetLocations(string query, System.Globalization.CultureInfo culture)
        {
            if (!String.IsNullOrEmpty(query) && !String.IsNullOrEmpty(query.Trim()))
            {
                String Query = query.Trim();
                try
                {
                    string RequestData = Helper.GetRequest(new Uri("http://pda.rp5.ru/?p=5&lang=ru&q=kanash"), Encoding.UTF8, 15000);
                    Regex re = new Regex("<p class=\"navy\">.*?</p>(\\s*<p>.+?<a href=\"(\\d+)/.+?\">(.+?)</a></p>\\s*)+", RegexOptions.IgnoreCase);
                }
                catch (Exception er)
                {
                }
            }
            return null;
        }

        public WeatherData GetWeatherReport(System.Globalization.CultureInfo culture, LocationData location, TemperatureScale tempScale, WindSpeedScale windSpeedScale, TimeSpan baseUtcOffset)
        {
            return null;
        }
    }
}
